#include <iostream>
#include <math.h>
using namespace std;

int getIdx(int i, int j, int n){
	return (n+(n-j+1))*(j)/2+(i-j);
}

void log(int *d, int size){
  cout<<endl;
  for(int i=0; i<size; i++) cout<<d[i]<<" ";
  cout<<endl;
}

void quick(int *d, int size, int lf, int rg){
	if(lf<rg){
		int lf_idx = lf+1;
		while(d[lf_idx]<d[lf]){
			if(lf_idx+1>size) break;
			lf_idx++;
		}
		
		int rg_idx = rg;
		while(d[rg_idx]>d[lf]){
			//if(rg_idx==0) break;
			rg_idx--;
		}
		
		//
		while(lf_idx<rg_idx){
			int temp = d[lf_idx];
			d[lf_idx] = d[rg_idx];
			d[rg_idx] = temp;
			
			lf_idx++;
			while(d[lf_idx]<d[lf]){
				if(lf_idx+1>size) break;
				lf_idx++;
			}
			rg_idx--;
			while(d[rg_idx]>d[lf]){
				rg_idx--;
			}			
		}
		
		int temp = d[lf];
		d[lf] = d[rg_idx];
		d[rg_idx] = temp;
		
		quick(d, size, lf, rg_idx-1);
		quick(d, size, rg_idx+1, rg);
	}
}

int find(int *d, int size, int lf, int rg, int k){	
	if(k<d[lf]) return lf-1;
	else if(k>d[rg]) return rg;

	if(rg<=lf+1) return lf;
	
	int mid = (lf+rg)/2;
	if(k<d[mid]) return find(d, size, lf, mid, k);
	else if(k==d[mid]) return mid;
	else  return find(d, size, mid, rg, k);
}


int find2(int *d, int size, int lf, int rg, int k){	
	if(k<=d[lf]) return d[lf];
	if(k>=d[rg]) return d[rg];
	
	while(lf+1<rg){
		int mid = (lf+rg)/2;
		if(k==d[mid]) return d[mid];
		
		if(k<d[mid]) rg = mid;
		else lf = mid;
	}
	
	return (k-d[lf]>d[rg]-k)?d[rg]:d[lf];
}

void init(int *a, int n, int *raw, int colNum){
	for(int i=0; i<n; i++){
		raw[i] = a[i];
		for(int j=0; j<=i && j<colNum; j++){
			if(i==0||j==0) continue;
			raw[getIdx(i,j, n)]=raw[getIdx(i-1, j-1, n)]+raw[i];
		}
	}	
}

int main(){
	int n,q;
	cin>>n>>q;
	
	/*
	0
	1   sum2(0,1)   
	2   sum2(1,2)      sum3(0,1,2)
	.
	.
	n-1 sum2(n-2,n-1)  ....      ....         sum_n-1(0, 1, 2, ... n-1)
	*/ 
	int a[n];
	int amax=0;
	for(int i=0; i<n; i++){
		cin>>a[i];
		if(a[i]>amax) amax = a[i];
	}
	
	int kk[q];
	int kmax=0;
	for(int i=0; i<q; i++){
		cin>>kk[i];
		if(kk[i]>kmax) kmax = kk[i];
	}

	int colnum = n;
	int an = (n*2-colnum+1)*colnum/2;
	int raw[an]={0};
	init(a, n, raw, colnum);
//	log(raw, an);
	quick(raw, an, 0, an-1);
//	log(raw, an);
		
	for(int i=0; i<q; i++){
		int k = kk[i];

		int min = find2(raw, an, 0, an-1, k);
		cout<<abs(min-k)<<endl;
	}		
}

/* test data 0   ====>  
10 10
7 29 39 8 27 41 13 47 26 34 
23 22 43 32 19 38 41 12 7 1
*/
